<div class="projects">
  <g:set var="maxPlotSize" value="${560}" />
  <g:each in="${Projects}" var="proj">
    <div class="proj">
      <div class="plot" style="width: ${((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.nrOfCelllines}px;">
        <div class="headlineR">
          <div class="nameR">${proj.name}</div>
          <g:if test="${(proj.pValue!=null)}" >
            <div class="pValue">p-Value = ${proj.pValueF}</div>
          </g:if>
        </div>
        <g:set var="range" value="${Math.pow(10,(Math.floor(Math.log10(proj.max))-1))}" />
        <g:set var="rangeNo" value="${(Math.ceil(proj.max/range)+1)}" />
        <g:set var="Scale" value="${(rangeNo*range)/100}"/>
        <g:set var="linePos" value="${0}" />
        <g:set var="stripes" value="${1}" />
        <g:each in="${proj.cls.sort{it.key}.keySet()}" var="cls">
          <div class="celllineR" style="width: ${((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.cls[cls].intensities.size()}px; left: ${linePos}px;<g:if test="${cls==Cellline}">background-color:#d9b2ff;</g:if><g:else><g:if test="${(cls==RefLine)}">background-color:#c6dfff;</g:if><g:else><g:if test="${(stripes%2)==1}">background-color:#fff;</g:if></g:else></g:else>">
            <g:set var="linePos" value="${linePos + ((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.cls[cls].intensities.size()}" />
            <g:set var="intNumber" value="${0}" />
            <g:each in="${proj.cls[cls].intensities}" var="intensity">
              <div class="bar" style="background-color: ${Colors[cls]}; height: ${intensity/Scale}%; width: ${((maxPlotSize/proj.nrOfCelllines).toInteger()-1)}px; left: ${(((maxPlotSize/proj.nrOfCelllines).toInteger())*intNumber)}px;"><div class="barname" >${proj.cls[cls].exps[intNumber]}</div></div>
              <g:set var="intNumber" value="${intNumber + 1}" />
            </g:each>
            <g:if test="${proj.cls[cls].intensities.size()>1}">
              <div class="average" style="bottom: ${Math.pow(10,proj.cls[cls].avg)/Scale}%;"></div>
            </g:if>
          </div>
          <g:set var="stripes" value="${stripes+1}" />
        </g:each>
        <g:if test="${proj.cls.size()>1}">
          <div class="average" style="bottom: ${Math.pow(10,proj.avg)/Scale}%;"></div>
        </g:if>
        <div class="xLabel" style="width: ${((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.nrOfCelllines}px;">
          <g:set var="linePos" value="${0}" />
          <g:each in="${proj.cls.sort{it.key}.keySet()}" var="cell">
            <div class="labelContainer elementR" style="width: ${((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.cls[cell].exps.size()}px; left: ${linePos}px;">
              <div class="label" style="right: ${((((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.cls[cell].exps.size())/2)-65}px;">${cell}</div>
            </div>
            <g:set var="linePos" value="${linePos + ((maxPlotSize/proj.nrOfCelllines).toInteger())*proj.cls[cell].intensities.size()}" />
          </g:each>
        </div>
        <div class="yLabel">
          <g:each in="${0..rangeNo}">
            <div class="scala<g:if test="${(it%5==0)||(it==rangeNo)}"> bold</g:if>" style="bottom:${(100*it)/rangeNo}%;"><g:if test="${(it%10==0)||(it==rangeNo)}"><div class="desk">${it}</div></g:if></div>
          </g:each>
          <div class="label">Expression Intensity [x 10<sup>${Math.log10(range).toInteger()}</sup>]</div>
        </div>
      </div>
      <div class="description list">
        <div class="data">
          <div class="line headlineR">
            <div class="elementR celllineR">Tissue of Origin</div>
            <g:if test="${(proj.pValue!=null)}">
            <div class="elementR reg">&uarr;&darr;&nbsp;&nbsp;&nbsp;Log2 Ratio</div>
            </g:if>
          </div>
          <g:each in="${proj.cls.sort{it.key}.keySet()}" var="cell">
            <div class="line updatePlot"<g:if test="${cell==Cellline}"> style="background-color:#D9B2FF;" </g:if><g:else><g:if test="${(cell==RefLine)}"> style="background-color:#c6dfff;" </g:if></g:else>>
              <div class="elementR colorbox" style="background-color: ${Colors[cell]};"></div>
              <div class="elementR celllineR" celllineName="${cell}"<g:if test="${cell==Cellline}"> style="font-weight: bold;" </g:if> >${cell}</div>
              <div class="elementR reg"<g:if test="${cell==Cellline}"> style="font-weight: bold;" </g:if> >
                <g:if test="${(cell!=RefLine)}">
                  <div class="<g:if test="${proj.cls[cell].regulation>=0}" >upReg" >&uarr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</g:if><g:else>downReg" >&darr;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</g:else>${proj.cls[cell].regulation}</div>
                </g:if>
                <g:if test="${(cell==RefLine)}">Reference</g:if>
              </div>
            </div>
          </g:each>
        </div>
      </div>
      <div class="updatingPlots"></div>
    </div>
  </g:each>
  <form name="update">
    <g:each in="${QueriedCelllines}" var="qCelllines">
      <g:hiddenField name="${qCelllines}" value="true" />
    </g:each>
    <g:hiddenField name="refLine" value="${RefLine}" />
    <g:hiddenField name="protein" value="${Protein.id}" />
    <g:submitToRemote action="getRegulationResults" update="regulationResults" value="Update" class="updatePlotButton"/>
  </form>
</div>
<script type="text/javascript">regulationPlotInit();</script>
